package com.sunny.design.decorator.gper;

/**
 * @author Sunny
 * @date 2020/3/5
 */
public class VipGperNavigateDecorator extends GperDecorator {
    private User user;
    public VipGperNavigateDecorator(Gper gper, User user) {
        super(gper);
        this.user = user;
    }

    @Override
    public String navigate() {
        String defaultNavigate = super.navigate();
        if (user != null) {
            System.out.println(user.getName() + " 登录成功!");
            if ("vip".equalsIgnoreCase(user.getPerms())) {
                defaultNavigate += ", 作业, 题库, 成长墙";
            } else {
                System.out.println("用户 " + user.getName() + " 没有vip权限, 展示默认导航条!");
            }
        } else {
            System.out.println("未登录状态!");
        }
        return defaultNavigate;
    }
}
